package com.fancy.learncenter.ui.adapter;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.fancy.learncenter.R;
import com.fancy.learncenter.bean.CartoonContructSatisticsesBean;
import com.fancy.learncenter.bean.CartoonErrorUnitListItemBean;
import com.fancy.learncenter.bean.CartoonHomeworkContructSatisticsesBean;
import com.fancy.learncenter.ui.activity.PreviewHomeWorkActivity;
import com.fancy.learncenter.ui.adapter.base.CommonRecycleViewAdapter;
import com.fancy.learncenter.ui.adapter.base.CustomViewHold;
import com.fancy.learncenter.ui.callback.AlbumImpl;

import java.util.List;

/**
 * Created by shiweiwei on 2018/1/24.
 */

public class CartoonHomeworkContentAdapter extends CommonRecycleViewAdapter<CartoonHomeworkContructSatisticsesBean> {

    private AlbumImpl listener;

    public void setListener(AlbumImpl listener) {
        this.listener = listener;
    }

    public CartoonHomeworkContentAdapter(Context mContext, List<CartoonHomeworkContructSatisticsesBean> itemDatas) {
        super(mContext, R.layout.cartoon_homework_content_item, itemDatas);
    }

    @Override
    public void bindView(CustomViewHold customViewHold, CartoonHomeworkContructSatisticsesBean item, final int position) {

        TextView text_name = customViewHold.getView(R.id.text_name);
        TextView question_num_text = customViewHold.getView(R.id.question_num_text);
        if (!TextUtils.isEmpty(item.getConstructName())) {
            text_name.setText(item.getConstructName());
        }

        if (!TextUtils.isEmpty(item.getTotalNums())) {

            question_num_text.setText(item.getTotalNums());
        }

        customViewHold.getRoorView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {


                if (listener != null) {
                    listener.onClick(position);
                }

            }
        });
    }
}
